<?php

// PHP雪里开轻量级报修系统 V1.0Beta
// 演示地址: http://baoxiu.chalide.cn
// 更新关注: /weivote
// 文件路径: inc/head.php
// 文件大小: 2303 字节
// 最后修改时间: 2025-05-21 16:37:15
// 作者: yujianyue
// 邮件: 15058593138@qq.com
// 版权所有,保留发行权和署名权

/**
 * 本文件功能：公共头部模板
 * 版权声明：保留发行权和署名权
 * 作者信息：功能反馈:15058593138@qq.com(手机号同微信)
 */

// 检查是否定义了必要的常量
if (!defined('SYSTEM_VERSION')) {
    header('Location: ../index.php');
    exit;
}

// 获取用户类型和菜单
$user_type = isset($_SESSION['user_type']) ? $_SESSION['user_type'] : '';
$user_name = isset($_SESSION['user_name']) ? $_SESSION['user_name'] : '';
$menu_items = isset($MENU[$user_type]) ? $MENU[$user_type] : [];
$current_do = isset($_GET['do']) ? $_GET['do'] : '';
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简易报修系统</title>
    <link rel="stylesheet" href="inc/css.css?v=<?php echo SYSTEM_VERSION; ?>">
    <script src="inc/js.js?v=<?php echo SYSTEM_VERSION; ?>"></script>
</head>
<body>
    <div class="header">
            <div class="header-inner">
                <div class="site-title">简易报修系统</div>
                <?php if (!empty($user_name)): ?>
                <div class="user-info">
                    <span class="user-name"><?php echo htmlspecialchars($user_name); ?> (<?php echo htmlspecialchars($user_type); ?>)</span>
                    <a href="?do=lgout" class="logout-btn">退出</a>
                </div>
                <?php endif; ?>
            </div>
    </div>
    
    <?php if (!empty($menu_items)): ?>
    <div class="nav">
        <!--div class="container"-->
            <div class="nav-inner">
                <?php foreach ($menu_items as $item): ?>
                <div class="nav-item <?php echo ($current_do == $item['do']) ? 'active' : ''; ?>" data-do="<?php echo htmlspecialchars($item['do']); ?>">
                    <?php echo htmlspecialchars($item['名称']); ?>
                </div>
                <?php endforeach; ?>
            </div>
        <!--/div-->
    </div>
    <?php endif; ?>
    
    <div class="container"><?php
// 显示提示消息
if (isset($_GET['msg']) && !empty($_GET['msg'])) {
    echo '<div class="alert ' . (isset($_GET['type']) && $_GET['type'] == 'error' ? 'alert-danger' : 'alert-success') . '">' . 
         htmlspecialchars($_GET['msg']) . '</div>';
}
?>
